 package tools;

 import com.alee.laf.optionpane.WebOptionPane;
 import com.alibaba.druid.pool.DruidPooledConnection;
 import database.DatabaseConnection;
 import java.awt.Component;
 import java.sql.PreparedStatement;
 import java.sql.SQLException;
 import java.util.Arrays;
 import java.util.List;
 import org.apache.logging.log4j.LogManager;
 import org.apache.logging.log4j.Logger;
 import server.console.Start;

 public class DeleteUserData
 {
/*  17 */   private static final Logger log = LogManager.getLogger(DeleteUserData.class.getName());
/*  18 */   private static final List<String> databasenames = Arrays.asList(new String[] { "accounts", "accounts_event", "accounts_info", "accounts_log", "achievements", "alliances", "androids", "bank", "battlelog", "bbs_replies", "bbs_threads", "bosslog", "buddies", "cashshop_categories", "cashshop_items", "cashshop_limit_sell", "cashshop_log", "cashshop_menuitems", "cashshop_modified_items", "character_cards", "character_coreauras", "character_credit", "character_keyvalue", "character_potionpots", "character_slots", "character_work", "characters", "cheatlog", "compensationlog_confirmed", "dojorankings", "donation", "donorlog", "dueypackages", "effectswitch", "eventforday", "eventtimes", "extendedslots", "famelog", "familiars", "families", "gifts", "gmlog", "guilds", "guildskills", "hacker", "hiredmerch", "imps", "innerskills", "internlog", "inventoryequipment", "inventoryitems", "inventorylog", "inventoryslot", "ipbans", "ipvotelog", "keymap", "lovelog", "macbans", "macfilters", "missionlist", "missionstatus", "monsterbook", "mountdata", "mts_cart", "mts_items", "notes", "nxcode", "parttime", "paylog", "pets", "pokemon", "pqlog", "pvpstats", "pwreset", "questinfo", "queststatus", "queststatusmobs", "quickslot", "rankingtop", "reports", "rings", "savedlocations", "scroll_log", "sidekicks", "skillmacros", "skills", "skills_cooldowns", "speedruns", "storages", "tournamentlog", "trocklocations", "vcoreskill", "vmatrixslot", "wishlist", "hypay", "auction", "auction_done", "auction_quotation", "mapleunion", "nirvanaflame", "playernpcs", "playernpcs_equip" });








































































































   public static synchronized void run() {
/* 124 */     setKeyChecks(0);
/* 125 */     for (String name : databasenames) {
/* 126 */       System.err.println("正在清空" + name + "表...");
/* 127 */       try(DruidPooledConnection con = DatabaseConnection.getInstance().getConnection(); 
/* 128 */           PreparedStatement ps = con.prepareStatement("TRUNCATE TABLE " + name)) {
/* 129 */         ps.executeUpdate();
       }
/* 131 */       catch (SQLException e) {
/* 132 */         log.error("清空" + name + "表失败", e);
       }
     }
/* 135 */     setKeyChecks(1);
/* 136 */     WebOptionPane.showMessageDialog((Component)Start.getInstance(), "玩家数据清空完成！");
   }

   private static synchronized void setKeyChecks(int mode) {
/* 140 */     try(DruidPooledConnection con = DatabaseConnection.getInstance().getConnection(); 
/* 141 */         PreparedStatement ps = con.prepareStatement("SET FOREIGN_KEY_CHECKS = " + mode)) {
/* 142 */       ps.executeUpdate();
     }
/* 144 */     catch (SQLException e) {
/* 145 */       log.error("操作外键失败", e);
     }
   }
 }


/* Location:              C:\PGX\Server.jar!\tools\DeleteUserData.class
 * Java compiler version: 8 (52.0)
 * JD-Core Version:       1.1.3
 */